package group.raber.base.filter;

import group.raber.saber.holder.WebHolder;

import javax.servlet.*;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

public class WebHolderFilter implements Filter {

    public void init(FilterConfig filterConfig) throws ServletException {

    }

    public void doFilter(ServletRequest req, ServletResponse rep, FilterChain chain) throws IOException, ServletException {
        HttpServletRequest request = (HttpServletRequest)req;
        HttpServletResponse response = (HttpServletResponse)rep;

        WebHolder.setRequest(request);
        WebHolder.setResponse(response);
//        WebHolder.setServletContext(request.getServletContext());

        chain.doFilter(request,response);
    }

    public void destroy() {

    }
}
